package com.bmd.backgroundmanger.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bmd.backgroundmanger.entity.QuestionTag;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 题目标签Mapper接口
 */
@Mapper
public interface QuestionTagMapper extends BaseMapper<QuestionTag> {
    
    /**
     * 根据题目ID查询标签
     */
    @Select("SELECT * FROM question_tags WHERE question_id = #{questionId}")
    List<QuestionTag> selectByQuestionId(Integer questionId);
    
    /**
     * 根据标签名称查询题目ID
     */
    @Select("SELECT DISTINCT question_id FROM question_tags WHERE tag_name LIKE CONCAT('%', #{tagName}, '%')")
    List<Integer> selectQuestionIdsByTagName(String tagName);
} 